<template>
  <div class="app">
    <div v-if="!isWebBluetoothSupported" class="error-message">
      您的浏览器不支持 Web Bluetooth，请使用 Chrome 或 Edge 浏览器。
    </div>
    <BluetoothControl v-else />
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import BluetoothControl from './components/BluetoothController.vue'

const isWebBluetoothSupported = ref(true)

onMounted(() => {
  if (!navigator.bluetooth) {
    isWebBluetoothSupported.value = false
  }
})
</script>

<style>
.app {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  background-color: #f5f7fa;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.error-message {
  background-color: #fff3f3;
  color: #ff4d4f;
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  max-width: 600px;
  margin: 20px auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .app {
    padding: 10px;
  }

  .error-message {
    margin: 10px;
  }
}
</style>